import '../index.dart';

//
// class AppThemeData {
//   static const _lightFillColor = Colors.black;
//   static const _darkFillColor = Colors.white;
//
//   static final Color _lightFocusColor = Colors.black.withOpacity(0.12);
//   static final Color _darkFocusColor = Colors.white.withOpacity(0.12);
//
//   static ThemeData lightThemeData(MaterialColor materialColor) {
//     Color textColor =
//         materialColor.computeLuminance() < 0.5 ? Colors.white : Colors.black;
//
//     return ThemeData(
//       primarySwatch: materialColor,
//       // textTheme: _textTheme,
//
//       appBarTheme: AppBarTheme(
//         titleTextStyle: TextStyle(color: textColor, fontSize: 20),
//         elevation: 0,
//         iconTheme: IconThemeData(color: textColor),
//         backgroundColor: materialColor,
//       ),
//     );
//   }
//
//   static ThemeData darkThemeData(MaterialColor materialColor) {
//     ColorScheme darkColorScheme = ColorScheme(
//       primary: materialColor,
//       primaryContainer: Color(0xFF1CDEC9),
//       secondary: Color(0xFF4D1F7C),
//       secondaryContainer: Color(0xFF451B6F),
//       background: Color(0xFF241E30),
//       surface: Color(0xFF1F1929),
//       onBackground: Color(0x0DFFFFFF),
//       // White with 0.05 opacity
//       error: _darkFillColor,
//       onError: _darkFillColor,
//       onPrimary: _darkFillColor,
//       onSecondary: _darkFillColor,
//       onSurface: _darkFillColor,
//       brightness: Brightness.dark,
//     );
//
//     return ThemeData(
//       colorScheme: darkColorScheme,
//       // textTheme: _textTheme,
//       // Matches manifest.json colors and background color.
//       primaryColor: darkColorScheme.primary,
//       appBarTheme: AppBarTheme(
//         titleTextStyle: const TextStyle(color: Colors.white, fontSize: 20),
//         backgroundColor: darkColorScheme.surface,
//         elevation: 0,
//         iconTheme: const IconThemeData(color: Colors.white),
//       ),
//       iconTheme: IconThemeData(color: darkColorScheme.onPrimary),
//       canvasColor: darkColorScheme.background,
//       scaffoldBackgroundColor: darkColorScheme.background,
//       highlightColor: Colors.transparent,
//       focusColor: _darkFocusColor,
//       snackBarTheme: SnackBarThemeData(
//         behavior: SnackBarBehavior.floating,
//         backgroundColor: Color.alphaBlend(
//           _lightFillColor.withOpacity(0.80),
//           _darkFillColor,
//         ),
//         // contentTextStyle: _textTheme.subtitle1!.apply(color: _darkFillColor),
//       ),
//     );
//   }
//
// // static const _regular = FontWeight.w400;
// // static const _medium = FontWeight.w500;
// // static const _semiBold = FontWeight.w600;
// // static const _bold = FontWeight.w700;
//
// // static const TextTheme _textTheme = TextTheme(
// //   headline4: TextStyle(fontWeight: _bold, fontSize: 18.0),
// //   caption: TextStyle(fontWeight: _semiBold, fontSize: 10.0),
// //   headline5: TextStyle(fontWeight: _medium, fontSize: 14.0),
// //   subtitle1: TextStyle(fontWeight: _medium, fontSize: 14.0),
// //   overline: TextStyle(fontWeight: _medium, fontSize: 10.0),
// //   bodyText1: TextStyle(fontWeight: _regular, fontSize: 14.0),
// //   subtitle2: TextStyle(fontWeight: _medium, fontSize: 14.0),
// //   bodyText2: TextStyle(fontWeight: _regular, fontSize: 16.0),
// //   headline6: TextStyle(fontWeight: _bold, fontSize: 16.0),
// //   button: TextStyle(fontWeight: _semiBold, fontSize: 14.0),
// // );
// }

class AppThemeData {
  // static const _lightFillColor = Colors.black;
  // static const _darkFillColor = Colors.white;

  static final Color _lightFocusColor = Colors.black.withOpacity(0.12);
  static final Color _darkFocusColor = Colors.white.withOpacity(0.12);

  static ThemeData lightThemeData =
      themeData(lightColorScheme, _lightFocusColor);
  static ThemeData darkThemeData = themeData(darkColorScheme, _darkFocusColor);

  static ThemeData themeData(ColorScheme colorScheme, Color focusColor) {
    return ThemeData(
      colorScheme: colorScheme,
      textTheme: _textTheme,
      // Matches manifest.json colors and background color.
      primaryColor: colorScheme.primary,
      appBarTheme: AppBarTheme(
        titleTextStyle: TextStyle(
            fontWeight: _bold, fontSize: 16.0, color: colorScheme.onBackground),
        // _textTheme.titleMedium?.copyWith(color: colorScheme.onBackground),
        backgroundColor: colorScheme.background,
        elevation: 0,
        iconTheme: IconThemeData(color: colorScheme.primary),
      ),
      iconTheme: IconThemeData(color: colorScheme.onPrimary),
      canvasColor: colorScheme.background,
      scaffoldBackgroundColor: colorScheme.background,
      highlightColor: Colors.transparent,
      focusColor: focusColor,
      snackBarTheme: SnackBarThemeData(
        behavior: SnackBarBehavior.floating,
        backgroundColor: colorScheme.background,
        contentTextStyle:
            _textTheme.subtitle1!.apply(color: colorScheme.onBackground),
      ),
    );
  }

  static const ColorScheme lightColorScheme = ColorScheme(
    // primary: Color(0xFF3B5EFD),
    // primaryContainer: Color(0xFF117378),
    // secondary: Color(0xFFEFF3F3),
    // secondaryContainer: Color(0xFFFAFBFB),
    // background: Colors.white,
    // surface: Color(0xFFFAFBFB),
    // onBackground: Colors.white,
    // error: Colors.black,
    // onError: Colors.black,
    // onPrimary: Colors.black,
    // onSecondary: Color(0xFF322942),
    // onSurface: Color(0xFF241E30),
    // brightness: Brightness.light,

    brightness: Brightness.light,
    primary: Color(0xFF3B5EFD),
    onPrimary: Color(0xFF333333),
    secondary: Color(0xFFF19E31),
    onSecondary: Color(0xFF666666),
    error: Color(0xFFF93F45),
    onError: Colors.white,
    background: Colors.white,
    onBackground: Colors.black,
    surface: Color(0xFFF3F5F7),
    onSurface: Color(0xFFD1D1D1),
  );

  static const ColorScheme darkColorScheme = ColorScheme(
    // primary: Color(0xFF3B5EFD),
    // primaryContainer: Color(0xFF1CDEC9),
    // secondary: Color(0xFF4D1F7C),
    // secondaryContainer: Color(0xFF451B6F),
    // background: Color(0xFF1B1827),
    // surface: Color(0xFF1F1929),
    // onBackground: Color(0xFF1B1827),
    // // White with 0.05 opacity
    // error: Colors.white,
    // onError: Colors.white,
    // onPrimary: Colors.white,
    // onSecondary: Colors.white,
    // onSurface: Colors.white,
    // brightness: Brightness.dark,

    brightness: Brightness.dark,
    primary: Color(0xFF3B5EFD),
    onPrimary: Color(0xFFCCCCCC),
    secondary: Color(0xFFF19E31),
    onSecondary: Color(0xFF999999),
    error: Color(0xFFF93F45),
    onError: Colors.black,
    background: Color(0xff121212),
    onBackground: Colors.white,
    surface: Color(0xFF1D1B19),
    onSurface: Color(0xFF2E2E2E),
  );

  static const _regular = FontWeight.w400;
  static const _medium = FontWeight.w500;
  static const _semiBold = FontWeight.w600;
  static const _bold = FontWeight.w700;

  static const TextTheme _textTheme = TextTheme(
    //展示 大
    displayLarge: TextStyle(fontWeight: _regular, fontSize: 60.0),
    //展示 中
    displayMedium: TextStyle(fontWeight: _regular, fontSize: 45.0),
    //展示 小
    displaySmall: TextStyle(fontWeight: _regular, fontSize: 36.0),

    //大标题 大
    headlineLarge: TextStyle(fontWeight: _regular, fontSize: 32.0),
    //大标题 中
    headlineMedium: TextStyle(fontWeight: _regular, fontSize: 28.0),
    //大标题 小
    headlineSmall: TextStyle(fontWeight: _regular, fontSize: 24.0),

    //标题文字 大
    titleLarge: TextStyle(fontWeight: _regular, fontSize: 22.0),
    //标题文字 中
    titleMedium: TextStyle(fontWeight: _medium, fontSize: 16.0),
    //标题文字 小
    titleSmall: TextStyle(fontWeight: _medium, fontSize: 14.0),

    //内容文字 大
    bodyLarge: TextStyle(fontWeight: _medium, fontSize: 16.0),
    //内容文字 中
    bodyMedium: TextStyle(fontWeight: _medium, fontSize: 14.0),
    //内容文字 小
    bodySmall: TextStyle(fontWeight: _medium, fontSize: 12.0),

    //辅助说明文字 大
    labelLarge: TextStyle(fontWeight: _medium, fontSize: 14.0),
    //辅助说明文字 中
    labelMedium: TextStyle(fontWeight: _medium, fontSize: 12.0),
    //辅助说明文字 小
    labelSmall: TextStyle(fontWeight: _medium, fontSize: 11.0),
  );
}
